<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
description('Test Promise reject inside Blink.');

window.jsTestIsAsync = true;

var reject;
var promise = new Promise(function(res, rej) { reject = rej; });
var blinkPromise = internals.createRejectedPromise(42);

promise.then(function() {
    testFailed('fulfilled');
}, function(value) {
    return blinkPromise;
}).then(function() {
    testFailed('fulfilled');
}, function(value) {
    result = value;
    shouldBe('result', '42');
}).then(finishJSTest, finishJSTest);

reject(118);

</script>
</body>
</html>
